```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>RocketMQ消费模式深度解析 | 技术小馆</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background-color: #f8fafc;
            color: #334155;
            line-height: 1.6;
        }
        h1, h2, h3, h4 {
            font-family: 'Noto Serif SC', serif;
            font-weight: 600;
            color: #1e293b;
        }
        .hero {
            background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
            color: white;
        }
        .card {
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        }
        .card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .code-block {
            background-color: #1e293b;
            color: #e2e8f0;
            border-left: 4px solid #3b82f6;
        }
        .comparison-table {
            border-collapse: separate;
            border-spacing: 0;
        }
        .comparison-table th {
            background-color: #3b82f6;
            color: white;
        }
        .comparison-table tr:nth-child(even) {
            background-color: #f1f5f9;
        }
        .comparison-table td:first-child {
            font-weight: 500;
        }
        .highlight {
            position: relative;
        }
        .highlight::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            height: 100%;
            width: 4px;
            background-color: #3b82f6;
        }
        .footer {
            background-color: #1e293b;
            color: #e2e8f0;
        }
        .footer a:hover {
            color: #93c5fd;
        }
    </style>
</head>
<body class="min-h-screen">
    <!-- Hero Section -->
    <section class="hero py-20 px-4 md:px-8">
        <div class="container mx-auto max-w-6xl">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl font-bold mb-4">RocketMQ消费模式</h1>
                    <h2 class="text-2xl md:text-3xl font-semibold mb-6">广播与集群模式的深度解析</h2>
                    <p class="text-lg opacity-90 mb-8">探索消息中间件的核心消费机制，构建高效可靠的消息处理架构</p>
                    <div class="flex space-x-4">
                        <a href="#broadcast" class="bg-white text-blue-600 px-6 py-3 rounded-lg font-medium hover:bg-blue-50 transition duration-200">
                            <i class="fas fa-broadcast-tower mr-2"></i>广播模式
                        </a>
                        <a href="#cluster" class="bg-blue-900 text-white px-6 py-3 rounded-lg font-medium hover:bg-blue-800 transition duration-200">
                            <i class="fas fa-network-wired mr-2"></i>集群模式
                        </a>
                    </div>
                </div>
                <div class="md:w-1/2">
                    <div class="bg-white bg-opacity-20 p-6 rounded-xl backdrop-blur-sm">
                        <div class="mermaid">
                            graph TD
                                A[Producer] -->|Publish| B[Topic]
                                B -->|Broadcast| C1[Consumer1]
                                B -->|Broadcast| C2[Consumer2]
                                B -->|Cluster| D1[Consumer1]
                                B -->|Cluster| D2[Consumer2]
                                style A fill:#3b82f6,color:white
                                style B fill:#1e293b,color:white
                                style C1 fill:#10b981,color:white
                                style C2 fill:#10b981,color:white
                                style D1 fill:#f59e0b,color:white
                                style D2 fill:#f59e0b,color:white
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-6xl px-4 md:px-8 py-12">
        <!-- Broadcast Mode Section -->
        <section id="broadcast" class="mb-20">
            <div class="flex items-center mb-8">
                <i class="fas fa-broadcast-tower text-3xl text-blue-600 mr-4"></i>
                <h2 class="text-3xl font-bold">广播消费模式的工作原理</h2>
            </div>
            
            <div class="grid md:grid-cols-5 gap-8">
                <div class="md:col-span-3">
                    <div class="bg-white rounded-xl shadow-md p-6 mb-6 card">
                        <h3 class="text-2xl font-semibold mb-4 text-blue-600">广播消费的基本概念</h3>
                        <p class="mb-4">广播消费(Broadcasting)是RocketMQ提供的一种消息消费模式，在这种模式下，每条消息会被投递给消费组内的所有消费者实例，每个消费者都会收到并处理完整的消息副本。</p>
                    </div>
                    
                    <div class="bg-white rounded-xl shadow-md p-6 mb-6 card">
                        <h3 class="text-2xl font-semibold mb-4 text-blue-600">广播消费的实现机制</h3>
                        
                        <div class="mb-4">
                            <h4 class="text-xl font-medium mb-2 flex items-center">
                                <i class="fas fa-exchange-alt text-blue-500 mr-2"></i>消息分发原理
                            </h4>
                            <ul class="list-disc pl-5 space-y-2">
                                <li>消费组内的每个消费者实例都会订阅Topic的所有队列</li>
                                <li>Broker不会对消费者进行负载均衡，而是向所有消费者投递消息</li>
                                <li>每个消费者收到的消息内容完全一致</li>
                            </ul>
                        </div>
                        
                        <div class="mb-4">
                            <h4 class="text-xl font-medium mb-2 flex items-center">
                                <i class="fas fa-database text-blue-500 mr-2"></i>消费进度管理
                            </h4>
                            <ul class="list-disc pl-5 space-y-2">
                                <li>每个消费者实例独立管理自己的消费进度(Offset)</li>
                                <li>消费位点存储在消费者本地</li>
                                <li>默认存储路径: <code class="bg-gray-100 px-2 py-1 rounded">{用户目录}/.rocketmq_offsets/{clientId}/{group}/Offsets.json</code></li>
                            </ul>
                        </div>
                        
                        <div class="mb-4">
                            <h4 class="text-xl font-medium mb-2 flex items-center">
                                <i class="fas fa-power-off text-blue-500 mr-2"></i>启动恢复机制
                            </h4>
                            <ul class="list-disc pl-5 space-y-2">
                                <li>消费者重启后会加载本地存储的消费位点</li>
                                <li>如果本地无位点记录，则从最新位点开始消费</li>
                                <li>不会影响其他消费者实例的消费进度</li>
                            </ul>
                        </div>
                        
                        <div>
                            <h4 class="text-xl font-medium mb-2 flex items-center">
                                <i class="fas fa-users text-blue-500 mr-2"></i>消费者增减处理
                            </h4>
                            <ul class="list-disc pl-5 space-y-2">
                                <li>新增消费者时，新消费者会从最新或配置的位点开始消费</li>
                                <li>消费者下线不会触发重新负载均衡</li>
                                <li>其他消费者实例不受影响，继续消费自己负责的全量消息</li>
                            </ul>
                        </div>
                    </div>
                </div>
                
                <div class="md:col-span-2">
                    <div class="bg-white rounded-xl shadow-md p-6 mb-6 card">
                        <h3 class="text-2xl font-semibold mb-4 text-blue-600">广播消费代码示例</h3>
                        <div class="code-block p-4 rounded-lg overflow-x-auto">
                            <pre><code class="text-sm">// 创建消费者实例
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("BroadcastingConsumerGroup");

// 设置为广播模式
consumer.setMessageModel(MessageModel.BROADCASTING);

// 订阅Topic
consumer.subscribe("TopicTest", "*");

// 注册消息监听器
consumer.registerMessageListener(new MessageListenerConcurrently() {
    @Override
    public ConsumeConcurrentlyStatus consumeMessage(List&lt;MessageExt&gt; msgs, 
        ConsumeConcurrentlyContext context) {
        System.out.printf("%s Receive New Messages: %s %n", 
            Thread.currentThread().getName(), msgs);
        // 处理消息逻辑
        return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
    }
});

// 启动消费者
consumer.start();</code></pre>
                        </div>
                    </div>
                    
                    <div class="bg-white rounded-xl shadow-md p-6 card">
                        <h3 class="text-2xl font-semibold mb-4 text-blue-600">广播模式适用场景</h3>
                        <div class="space-y-4">
                            <div class="flex items-start">
                                <div class="bg-blue-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-cog text-blue-600"></i>
                                </div>
                                <div>
                                    <h4 class="font-medium">配置更新场景</h4>
                                    <p class="text-sm text-gray-600">系统配置变更需要通知所有服务实例</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <div class="bg-blue-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-database text-blue-600"></i>
                                </div>
                                <div>
                                    <h4 class="font-medium">本地缓存同步</h4>
                                    <p class="text-sm text-gray-600">需要所有应用实例同步更新本地缓存数据</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <div class="bg-blue-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-copy text-blue-600"></i>
                                </div>
                                <div>
                                    <h4 class="font-medium">多副本数据处理</h4>
                                    <p class="text-sm text-gray-600">每个消费者需要独立处理完整数据</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <div class="bg-blue-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-bell text-blue-600"></i>
                                </div>
                                <div>
                                    <h4 class="font-medium">应用状态广播</h4>
                                    <p class="text-sm text-gray-600">将状态变更广播给所有服务实例</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <div class="bg-blue-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-globe text-blue-600"></i>
                                </div>
                                <div>
                                    <h4 class="font-medium">多地部署场景</h4>
                                    <p class="text-sm text-gray-600">跨地域部署的相同服务需要接收同样的消息</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        
        <!-- Cluster Mode Section -->
        <section id="cluster" class="mb-20">
            <div class="flex items-center mb-8">
                <i class="fas fa-network-wired text-3xl text-orange-500 mr-4"></i>
                <h2 class="text-3xl font-bold">集群消费模式的负载均衡机制</h2>
            </div>
            
            <div class="grid md:grid-cols-5 gap-8">
                <div class="md:col-span-3">
                    <div class="bg-white rounded-xl shadow-md p-6 mb-6 card">
                        <h3 class="text-2xl font-semibold mb-4 text-orange-500">集群消费的基本概念</h3>
                        <p class="mb-4">集群消费(Clustering)是RocketMQ的默认消费模式，在这种模式下，同一个消费组内的消费者实例会平均分摊消息队列，每条消息只会被组内的某一个消费者处理。</p>
                    </div>
                    
                    <div class="bg-white rounded-xl shadow-md p-6 mb-6 card">
                        <h3 class="text-2xl font-semibold mb-4 text-orange-500">集群消费的负载均衡原理</h3>
                        
                        <div class="mb-4">
                            <h4 class="text-xl font-medium mb-2 flex items-center">
                                <i class="fas fa-project-diagram text-orange-500 mr-2"></i>队列分配机制
                            </h4>
                            <ul class="list-disc pl-5 space-y-2">
                                <li>一个Topic包含多个消息队列(MessageQueue)</li>
                                <li>消费组内的消费者按照负载均衡策略分配这些队列</li>
                                <li>每个队列在同一时间只会被分配给一个消费者处理</li>
                            </ul>
                        </div>
                        
                        <div class="mb-4">
                            <h4 class="text-xl font-medium mb-2 flex items-center">
                                <i class="fas fa-calculator text-orange-500 mr-2"></i>常用负载均衡算法
                            </h4>
                            <ul class="list-disc pl-5 space-y-2">
                                <li><strong>平均分配(AVG)</strong>：尽量均衡地将队列分配给消费者</li>
                                <li><strong>环形分配(AllocateMessageQueueAveragely)</strong>：默认策略，按消费者顺序轮流分配队列</li>
                                <li><strong>一致性哈希(AllocateMessageQueueConsistentHash)</strong>：基于一致性哈希算法，减少重新分配的影响</li>
                                <li><strong>手动配置(AllocateMessageQueueByConfig)</strong>：根据配置文件指定分配关系</li>
                            </ul>
                        </div>
                        
                        <div class="mb-4">
                            <h4 class="text-xl font-medium mb-2 flex items-center">
                                <i class="fas fa-random text-orange-500 mr-2"></i>再平衡过程(Rebalance)
                            </h4>
                            <ul class="list-disc pl-5 space-y-2">
                                <li>当消费组成员变化时(新增或移除消费者实例)</li>
                                <li>当订阅的Topic队列数量变化时</li>
                                <li>系统会触发队列重新分配，确保负载均衡</li>
                            </ul>
                        </div>
                        
                        <div>
                            <h4 class="text-xl font-medium mb-2 flex items-center">
                                <i class="fas fa-sync-alt text-orange-500 mr-2"></i>重平衡流程
                            </h4>
                            <div class="mermaid mt-2">
                                graph TD
                                    A[消费者变更] --> B[获取消费组内所有消费者列表]
                                    B --> C[获取Topic的所有队列列表]
                                    C --> D[按照指定的负载均衡算法进行队列分配]
                                    D --> E[对比新旧分配结果]
                                    E --> F[释放不再负责的队列，接管新分配的队列]
                                    F --> G[从新队列的上次消费位点继续消费]
                            </div>
                        </div>
                    </div>
                    
                    <div class="bg-white rounded-xl shadow-md p-6 card">
                        <h3 class="text-2xl font-semibold mb-4 text-orange-500">集群消费的位点管理</h3>
                        
                        <div class="mb-4">
                            <h4 class="text-xl font-medium mb-2 flex items-center">
                                <i class="fas fa-database text-orange-500 mr-2"></i>消费位点存储
                            </h4>
                            <ul class="list-disc pl-5 space-y-2">
                                <li>消费位点集中存储在Broker端</li>
                                <li>按消费组维度存储，同一组内的消费者共享位点信息</li>
                            </ul>
                        </div>
                        
                        <div class="mb-4">
                            <h4 class="text-xl font-medium mb-2 flex items-center">
                                <i class="fas fa-upload text-orange-500 mr-2"></i>位点提交机制
                            </h4>
                            <ul class="list-disc pl-5 space-y-2">
                                <li>消息消费成功后，自动提交位点</li>
                                <li>默认每隔5秒批量提交一次位点</li>
                                <li>消费者正常关闭时会触发一次位点提交</li>
                            </ul>
                        </div>
                        
                        <div>
                            <h4 class="text-xl font-medium mb-2 flex items-center">
                                <i class="fas fa-redo text-orange-500 mr-2"></i>位点恢复策略
                            </h4>
                            <ul class="list-disc pl-5 space-y-2">
                                <li>消费者重启后，会从Broker获取上次提交的位点继续消费</li>
                                <li>如果是新的消费组，可以配置从最新位点或最早位点开始消费</li>
                            </ul>
                        </div>
                    </div>
                </div>
                
                <div class="md:col-span-2">
                    <div class="bg-white rounded-xl shadow-md p-6 mb-6 card">
                        <h3 class="text-2xl font-semibold mb-4 text-orange-500">集群消费代码示例</h3>
                        <div class="code-block p-4 rounded-lg overflow-x-auto">
                            <pre><code class="text-sm">// 创建消费者实例
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("ClusteringConsumerGroup");

// 设置为集群模式(默认)
consumer.setMessageModel(MessageModel.CLUSTERING);

// 配置负载均衡策略(可选，默认为AllocateMessageQueueAveragely)
consumer.setAllocateMessageQueueStrategy(new AllocateMessageQueueAveragely());

// 订阅Topic
consumer.subscribe("TopicTest", "*");

// 注册消息监听器
consumer.registerMessageListener(new MessageListenerConcurrently() {
    @Override
    public ConsumeConcurrentlyStatus consumeMessage(List&lt;MessageExt&gt; msgs, 
        ConsumeConcurrentlyContext context) {
        System.out.printf("%s Receive New Messages: %s %n", 
            Thread.currentThread().getName(), msgs);
        // 处理消息逻辑
        return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
    }
});

// 启动消费者
consumer.start();</code></pre>
                        </div>
                    </div>
                    
                    <div class="bg-white rounded-xl shadow-md p-6 card">
                        <h3 class="text-2xl font-semibold mb-4 text-orange-500">集群模式适用场景</h3>
                        <div class="space-y-4">
                            <div class="flex items-start">
                                <div class="bg-orange-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-tasks text-orange-600"></i>
                                </div>
                                <div>
                                    <h4 class="font-medium">任务处理场景</h4>
                                    <p class="text-sm text-gray-600">大量同质任务需要分布式处理</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <div class="bg-orange-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-balance-scale text-orange-600"></i>
                                </div>
                                <div>
                                    <h4 class="font-medium">负载均衡要求</h4>
                                    <p class="text-sm text-gray-600">消息处理负载需要在多个实例间均衡分配</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <div class="bg-orange-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-check-circle text-orange-600"></i>
                                </div>
                                <div>
                                    <h4 class="font-medium">消费保障要求</h4>
                                    <p class="text-sm text-gray-600">需要确保每条消息被精确处理一次</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <div class="bg-orange-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-expand text-orange-600"></i>
                                </div>
                                <div>
                                    <h4 class="font-medium">水平扩展场景</h4>
                                    <p class="text-sm text-gray-600">通过增加消费者实例提升整体处理能力</p>
                                </div>
                            </div>
                            <div class="flex items-start">
                                <div class="bg-orange-100 p-2 rounded-full mr-3">
                                    <i class="fas fa-sort-amount-down text-orange-600"></i>
                                </div>
                                <div>
                                    <h4 class="font-medium">顺序消息处理</h4>
                                    <p class="text-sm text-gray-600">需要保证同类消息的处理顺序</p>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        
        <!-- Comparison Section -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <i class="fas fa-balance-scale-left text-3xl text-purple-600 mr-4"></i>
                <h2 class="text-3xl font-bold">两种模式的适用场景和配置方法</h2>
            </div>
            
            <div class="grid md:grid-cols-3 gap-8">
                <div class="md:col-span-2">
                    <div class="bg-white rounded-xl shadow-md p-6 card">
                        <h3 class="text-2xl font-semibold mb-4 text-purple-600">模式对比表</h3>
                        <div class="overflow-x-auto">
                            <table class="comparison-table w-full rounded-lg overflow-hidden">
                                <thead>
                                    <tr>
                                        <th class="px-4 py-3 text-left">特性</th>
                                        <th class="px-4 py-3 text-left">广播模式(Broadcasting)</th>
                                        <th class="px-4 py-3 text-left">集群模式(Clustering)</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td class="px-4 py-3 border-b">消息副本</td>
                                        <td class="px-4 py-3 border-b">每个消费者收到全量消息</td>
                                        <td class="px-4 py-3 border-b">每条消息只被一个消费者处理</td>
                                    </tr>
                                    <tr>
                                        <td class="px-4 py-3 border-b">负载均衡</td>
                                        <td class="px-4 py-3 border-b">不支持，每个消费者均处理全部消息</td>
                                        <td class="px-4 py-3 border-b">支持，队列平均分配给消费者</td>
                                    </tr>
                                    <tr>
                                        <td class="px-4 py-3 border-b">消费进度</td>
                                        <td class="px-4 py-3 border-b">每个消费者独立管理，存储在本地</td>
                                        <td class="px-4 py-3 border-b">集中存储在Broker，消费组内共享</td>
                                    </tr>
                                    <tr>
                                        <td class="px-4 py-3 border-b">重复消费</td>
                                        <td class="px-4 py-3 border-b">消费者重启可能导致消息重复消费</td>
                                        <td class="px-4 py-3 border-b">消费位点持久化，通常不会重复消费</td>
                                    </tr>
                                    <tr>
                                        <td class="px-4 py-3 border-b">消费保证</td>
                                        <td class="px-4 py-3 border-b">不保证每条消息一定被消费</td>
                                        <td class="px-4 py-3 border-b">保证每条消息至少被消费一次</td>
                                    </tr>
                                    <tr>
                                        <td class="px-4 py-3 border-b">消息重试</td>
                                        <td class="px-4 py-3 border-b">不支持，失败消息无法自动重试</td>
                                        <td class="px-4 py-3 border-b">支持完整的重试机制</td>
                                    </tr>
                                    <tr>
                                        <td class="px-4 py-3 border-b">扩展性</td>
                                        <td class="px-4 py-3 border-b">增加消费者不会减轻单个消费者负载</td>
                                        <td class="px-4 py-3 border-b">增加消费者可线性提升消费能力</td>
                                    </tr>
                                    <tr>
                                        <td class="px-4 py-3">适用规模</td>
                                        <td class="px-4 py-3">适合小规模消费者和消息量</td>
                                        <td class="px-4 py-3">适合大规模消费者集群和消息量</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
                
                <div>
                    <div class="bg-white rounded-xl shadow-md p-6 card">
                        <h3 class="text-2xl font-semibold mb-4 text-purple-600">配置方法与最佳实践</h3>
                        
                        <div class="mb-6">
                            <h4 class="text-lg font-medium mb-2">广播模式配置</h4>
                            <div class="code-block p-4 rounded-lg mb-4">
                                <pre><code class="text-sm">// Java SDK配置
consumer.setMessageModel(MessageModel.BROADCASTING);

// Spring配置
@Bean
public DefaultMQPushConsumer consumer() {
    DefaultMQPushConsumer consumer = new DefaultMQPushConsumer("BroadcastGroup");
    consumer.setMessageModel(MessageModel.BROADCASTING);
    // 其他配置
    return consumer;
}</code></pre>
                            </div>
                        </div>
                        
                        <div class="mb-6">
                            <h4 class="text-lg font-medium mb-2">集群模式配置</h4>
                            <div class="code-block p-4 rounded-lg mb-4">
                                <pre><code class="text-sm">// Java SDK配置(默认)
consumer.setMessageModel(MessageModel.CLUSTERING);

// 负载均衡策略配置
consumer.setAllocateMessageQueueStrategy(new AllocateMessageQueueAveragely());</code></pre>
                            </div>
                        </div>
                        
                        <div class="mb-6">
                            <h4 class="text-lg font-medium mb-2">广播模式最佳实践</h4>
                            <ul class="list-disc pl-5 space-y-2 text-sm">
                                <li>保证消费者的幂等处理能力，防止重复消费问题</li>
                                <li>注意管理本地消费位点文件，避免磁盘空间问题</li>
                                <li>考虑消息量增长对广播模式消费者的压力</li>
                                <li>避免过多消费者实例，可能导致Broker负载过高</li>
                            </ul>
                        </div>
                        
                        <div class="mb-6">
                            <h4 class="text-lg font-medium mb-2">集群模式最佳实践</h4>
                            <ul class="list-disc pl-5 space-y-2 text-sm">
                                <li>合理设计消费组，避免不必要的组划分</li>
                                <li>适当设置消费者数量，通常略少于队列总数</li>
                                <li>监控消费延迟，及时调整消费者实例数量</li>
                                <li>实现良好的消费者扩缩容机制，平滑处理再平衡</li>
                            </ul>
                        </div>
                        
                        <div>
                            <h4 class="text-lg font-medium mb-2">切换注意事项</h4>
                            <ul class="list-disc pl-5 space-y-2 text-sm">
                                <li>两种模式之间切换会影响消息消费状态</li>
                                <li>从广播切换到集群需处理好本地消费位点与Broker位点的同步</li>
                                <li>从集群切换到广播可能导致消息重复消费</li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        
        <!-- Conclusion -->
        <section class="bg-white rounded-xl shadow-md p-8 card">
            <div class="text-center">
                <i class="fas fa-lightbulb text-4xl text-yellow-500 mb-4"></i>
                <h3 class="text-2xl font-bold mb-4">关键总结</h3>
                <p class="text-lg mb-6">通过理解和正确应用RocketMQ的广播模式和集群模式，开发人员可以根据业务场景选择最合适的消费模式，实现高效、可靠的消息处理架构。</p>
                <div class="flex justify-center space-x-4">
                    <div class="bg-blue-50 p-4 rounded-lg text-center w-1/3">
                        <i class="fas fa-broadcast-tower text-blue-600 text-2xl mb-2"></i>
                        <h4 class="font-medium">广播模式</h4>
                        <p class="text-sm text-gray-600">全量消息，消费者独立</p>
                    </div>
                    <div class="bg-orange-50 p-4 rounded-lg text-center w-1/3">
                        <i class="fas fa-network-wired text-orange-600 text-2xl mb-2"></i>
                        <h4 class="font-medium">集群模式</h4>
                        <p class="text-sm text-gray-600">负载均衡，共享位点</p>
                    </div>
                </div>
            </div>
        </section>
    </main>
    
    <!-- Footer -->
    <footer class="footer py-8 px-4 md:px-8">
        <div class="container mx-auto max-w-6xl">
            <div class="flex flex-col md:flex-row justify-between items-center">
                <div class="mb-4 md:mb-0">
                    <h3 class="text-xl font-medium">技术小馆</h3>
                </div>
                <div>
                    <a href="http://www.yuque.com/jtostring" class="hover:underline">http://www.yuque.com/jtostring</a>
                </div>
            </div>
        </div>
    </footer>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: false,
                htmlLabels: true,
                curve: 'basis'
            }
        });
        
        // 平滑滚动
        document.querySelectorAll('a[href^="#"]').forEach(anchor => {
            anchor.addEventListener('click', function (e) {
                e.preventDefault();
                document.querySelector(this.getAttribute('href')).scrollIntoView({
                    behavior: 'smooth'
                });
            });
        });
    </script>
</body>
</html>
```